package demo;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LianBao
 * Date: 2024-03-14
 * Time: 11:42
 */

class OuterClass2 {

    public int data1 = 1;
    private int data2 = 2;
    public static int data3 = 3;
    public int name = 1999;

    /**
     * 静态内部类
     * 1.如何使用静态内部类?
     * 外部类.内部类 变量名字 = new 外部类.内部类
     *
     */
    static class InnerClass2 {
        public int data4 = 4;
        private int data5 = 5;
        public static int data6 = 6;
        public int name = 0;

        public void test() {
            OuterClass2 outerClass2 = new OuterClass2();
            System.out.println("InnerClass2test()");
            System.out.println(data4);
            System.out.println(data5);
            System.out.println(data6);
            System.out.println(OuterClass2.data3);
            System.out.println(this.name);
            System.out.println(outerClass2.name);
            System.out.println(outerClass2.data1);
            System.out.println(outerClass2.data2);
        }
    }

}

public class Test2 {



    public static void main(String[] args) {
        OuterClass2.InnerClass2 innerClass2 = new OuterClass2.InnerClass2();
        innerClass2.test();
    }
}
